package examples;

import java.net.URL;

import objects.DomainSeo;

import org.apache.jasper.tagplugins.jstl.core.Url;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import debugs.DomainSeoDebug;

import helpers.SiteAnalyticHelper;

public class SeoToolEx {
	public static void main(String[] args) {
		String url = "http://www.domainworlds.net/";
		DomainSeo domainSeo = new DomainSeo();
		try {
			Document doc = Jsoup.connect(url).get();
			
			SiteAnalyticHelper siteHelper = new SiteAnalyticHelper(doc.html());
			String title = siteHelper.getTitle();
			String description = siteHelper.getDescription();
			String keywords = siteHelper.getKeywords();
			
			domainSeo.setLenUrl(url.length());
			domainSeo.setLenMetaKeywords(keywords.length());
			domainSeo.setCountMetaKeywords(keywords.split(" ").length);
			domainSeo.setLenMetaDescription(description.length());
			domainSeo.setH1(siteHelper.countHeading("h1"));
			domainSeo.setH2(siteHelper.countHeading("h2"));
			domainSeo.setH3(siteHelper.countHeading("h3"));
			domainSeo.setH4(siteHelper.countHeading("h4"));
			domainSeo.setH5(siteHelper.countHeading("h5"));
			domainSeo.setH6(siteHelper.countHeading("h6"));
			domainSeo.setImages(siteHelper.countImage());
			domainSeo.setAltEmptyImage(siteHelper.countAltImageEmpty());
			domainSeo.setEncoding(siteHelper.getCharset());
			
			try {
				URL urlA = new URL("http://www.websiteus.org/abc");
			} catch (Exception e) {
				// TODO: handle exception
				System.out.println("aaaaa");
			}
			
			
		} catch (Exception e) {
			// TODO: handle exception
		}
		
		DomainSeoDebug.debug(domainSeo);
	}
}
